// 组件构造器
const beh = require('../heh')
Component({
  // 内置behaviore: wx://component-export
  behaviors: [
    'wx://component-export',
    beh
  ],

  data: {
    x: 10000
  },

  properties: {
    parentData: {
      // type: Number,
      value: 200,
      optionalTypes: [Number, String],
      observer(newValue) {
        // console.log(newValue)
      }
    }
  },

  methods: {
    handleTap(e) {
      this.triggerEvent('myevent', 10)

      console.log(e.target.dataset.abc)
    },

    handleViewTap() {
      console.log('view taped.')
    },

    handleDelete({ detail }) {
      console.log('del')
    }
  },


  export() {
    return { 
      myField: 'myValue',
      x: this.data.x
    }
  },

  // 生命周期函数
  lifetimes: {
    ready() {
      console.log(100)
      console.log(this.data.x)
    }
  },

  pageLifetimes: {
    show() {
      console.log(200)
    }
  }

  // ready() {
  //   console.log(200)
  // }
})